﻿@namespace FluentCMS.Web.Plugins

@if (Model != null)
{
    <EditForm Model="@Model" OnSubmit="HandleSubmit" FormName="@Name" Enhance>
        <DataAnnotationsValidator />                
        <Modal Placement="ModalPlacement.Top" Size="ModalSize.Large" Visible="Open">
            <ModalHeader>@Title</ModalHeader>
            <ModalBody>
                <Grid GutterX="GridGutter.Large">
                    @ChildContent
                </Grid>
                <Spacer Visible="Errors.Count > 0" />
                <Alert Visible="Errors.Count > 0" Type="AlertType.Danger">
                    @foreach (var error in Errors)
                    {
                        <p>@error</p>
                    }
                </Alert>
            </ModalBody>
            <ModalFooter>
                <Stack Justify="StackJustify.End">
                    <Button @onclick="HandleCancel">Cancel</Button>
                    <Button Color="Color.Primary" Type="ButtonType.Submit">Submit</Button>
                </Stack>
            </ModalFooter>
        </Modal>
    </EditForm>
}